﻿using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace FangDuShi_Front
{
    /// <summary>
    /// 错误消息定义
    /// </summary>
    public static class UniValidate
    {
        /// <summary>
        /// 没有错误{'code':'0','msg':'没有错误'}
        /// </summary>
        /// <param name="jsonDataMsg"></param>
        /// <returns></returns>
        public static string NoError(string jsonDataMsg = "")
        {
            JObject jObject = new JObject();
            jObject["code"] = "0";
            jObject["msg"] = "没有错误";
            string message = jObject.ToString();
            if (jsonDataMsg != "")
            {
                jObject = new JObject();
                jObject["code"] = "0";
                jObject["msg"] = jsonDataMsg;
                message = jObject.ToString();
            }
            return message;
        }
        /// <summary>
        /// 不能为空
        /// </summary>
        /// <param name="message"></param>
        /// <returns></returns>
        public static string NotEmptyError(string message)
        {
            JObject jObject = new JObject();
            jObject["code"] = "10001";
            jObject["msg"] = message;
            return jObject.ToString();
        }

        public static string ServerInternalError(string message = "{'code':'31209','msg':'服务器错误'}")
        {
            return message;
        }
    }
}